<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="./vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>聊天应用 | Web Chat</title>
    <script>
      // 处理客户端路由重定向
      (function() {
        // 检查URL中是否包含由404.html添加的路径参数
        var pathParam = new URLSearchParams(window.location.search).get('__pathname');
        if (pathParam) {
          // 移除__pathname参数
          var newSearch = window.location.search
            .replace(/[?&]__pathname=[^&]+/, '')
            .replace(/^&/, '?');
          
          // 构建新的URL，使用真实路径
          var newUrl = window.location.origin + 
                      (newSearch === '?' ? '' : newSearch) + 
                      window.location.hash;
          
          // 使用History API替换当前URL，不刷新页面
          window.history.replaceState(null, '', decodeURIComponent(pathParam));
        }
      })();
    </script>
  </head>
  <body>
    <div id="root"></div>
    <script type="module" src="./src/main.jsx"></script>
  </body>
</html>
